using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using LocalBoard.Domain;

namespace LocalBoard.Web
{
	public partial class GetBoardList : DefaultClubPage
	{
		protected void Page_Load(object sender, EventArgs e)
		{
			StringBuilder sb = new StringBuilder("{\"items\":[");
			ArrayList boardList = ClubController.GetBoardList();
			for (int i = 0; i < boardList.Count; i++ )
			{
				Board b = boardList[i] as Board;
				if (i > 0)
					sb.Append(",");
				sb.Append("{");
				sb.Append(string.Format("\"n\":\"{0}\",\"pn\":\"{1}\",\"a\":\"{2}\",\"u\":\"{3}\",\"lo\":\"{4}\",\"la\":\"{5}\"", b.Name, b.PlaceName, b.Address, "SeeBoard.aspx?board=" + b.Id, b.Longitude, b.Latitude));
				sb.Append("}");
			}
			sb.Append("]}");
			Response.Clear();
			Response.Write(sb.ToString());
			Response.End();
		}
	}
}